package main

import (
	"net/http"
	"fmt"
	"html"
	"net/http/pprof"
)

func fooHandle(w http.ResponseWriter,r *http.Request){
	fmt.Fprintf(w,"Hello,%q",html.EscapeString(r.URL.Path))
	//处理静态资源文件的
	http.ServeFile(w,r,"E:\\JetBrains\\GoglandProjects\\beego\\src\\static\\1.js")
}


func Get(w http.ResponseWriter,r *http.Request){
	switch r.FormValue("name") {
	default:
		pprof.Index(w,r)
	case "cmdline":
		pprof.Cmdline(w,r)
	case "profile":
		pprof.Profile(w,r)
	case "symbol":
		pprof.Symbol(w,r)
	}
	w.WriteHeader(200)
}


func main() {
	http.HandleFunc("/get",Get)
	http.HandleFunc("/foo",fooHandle)
	http.HandleFunc("/bar", func(w http.ResponseWriter, r *http.Request) {
		fmt.Fprintf(w,"hello,%q",html.EscapeString(r.URL.Path))
	})
	http.ListenAndServe(":8080",nil)
}